package com.googlecode.mgwt.examples.uibinder.client.activities.examples;

import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.googlecode.mgwt.dom.client.event.touch.simple.SimpleTouchEvent;
import com.googlecode.mgwt.examples.uibinder.client.activities.ExampleDisplay;
import com.googlecode.mgwt.ui.client.button.ButtonBase;

public class AbstractExampleDisplayGwtImpl extends Composite implements ExampleDisplay {

	private Presenter presenter;

	@UiField
	ButtonBase backButton;

	@UiField
	ButtonBase sourceButton;

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;

	}

	@UiHandler("backButton")
	protected void onBackButtonPressed(SimpleTouchEvent event) {
		if (presenter != null) {
			presenter.onBackButtonPressed();
		}
	}

	@UiHandler("sourceButton")
	protected void onSourceButtonPressed(SimpleTouchEvent event) {
		if (presenter != null) {
			presenter.onSourceButtonPressed();
		}
	}
}
